<%@ page contentType="text/html; charset=UTF-8" language="java" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ include file="include.jsp" %>
<html>
<head>
    <title>Регистрация</title>

    <style type="text/css">

        .title {
            text-align: center;
            font-family: sans-serif;
            font-size: larger;
            color: #6699cc;
            width: 1000px;
            margin: 0 auto;
        }

        .form {
            width: 1000px;
            margin: 0 auto;
            font-family: sans-serif;
            font-style: normal;

        }

        .form select {
            width: 200px;
            border: medium solid #FFFFFF;
            background-color: #e0e0e0;
        }

        .form input {
            width: 200px;
        }

        input.button {
            cursor: pointer;
            background-color: #FFCC00;
            font-weight: bold;
            width: 100px;

        }

        .form td {
            font-size: x-small;
            font-weight: bold;

        }


    </style>


</head>

<body>
<%@ include file="menu.jsp" %>

<div class="title">
    Регистрация в системе
</div>
<br>


<form:form method="POST" commandName="newUser" cssClass="form">
    <fieldset>
        <table style="width:800px">

            <tr>
                <td>Имя</td>
                <td><form:input path="firstName"/></td>
                <td><form:errors path="firstName" cssStyle="color:red;"/></td>
            </tr>
            <tr>
                <td>Фамилия</td>
                <td><form:input path="lastName"/></td>
                <td><form:errors path="lastName" cssStyle="color:red;"/></td>
            </tr>
            <tr>
                <td>Логин
                </td>
                <td><form:input path="login"/></td>
                <td><form:errors path="login" cssStyle="color:red;"/></td>
            </tr>
            <tr>
                <td>Электропочта</td>
                <td><form:input path="email"/></td>
                <td><form:errors path="email" cssStyle="color:red;"/></td>
            </tr>
            <tr>
                <td>Пароль</td>
                <td><form:password path="password"/></td>
                <td><form:errors path="password" cssStyle="color:red;"/></td>
            </tr>
            <tr>
                <td>Пароль еще раз</td>
                <td><form:password path="password"/></td>
                <td><form:errors path="password" cssStyle="color:red;"/></td>
            </tr>
            <tr>
                <td>Суперсекретный код<br>
                    <c:url var="captchPath" value="/captcha.htm"/>
                    <img src="${captchPath}"/>
                </td>
                <td><input type="text" name="j_captcha_response"/></td>
                <td style="color:red;">
                    <spring:hasBindErrors name="newUser">
                        <c:if test="${not empty errors.globalErrors}">
                            <c:forEach items="${errors.globalErrors}" var="error">
                                <c:out value="${error.defaultMessage}"/>
                            </c:forEach>
                        </c:if>
                    </spring:hasBindErrors>

                </td>
            </tr>
            <tr>
                <td></td>
                <td></td>
                <td><input type="submit" value="submit" name="_finish" class="button"></td>
            </tr>
        </table>
    </fieldset>
</form:form>
</body>
</html>